LEFT JOIN bb".$n."_posts ON (bb".$n."_posts.postid=bb".$n."_boards.lastpostid)
LEFT JOIN bb".$n."_threads ON (bb".$n."_threads.threadid=bb".$n."_posts.threadparentid)
LEFT JOIN bb".$n."_user_table ON (bb".$n."_user_table.userid=bb".$n."_posts.userid)
WHERE bb".$n."_boards.boardparentid>0
ORDER by boardparentid ASC, sort ASC");
while ($row = $db_zugriff->fetch_array($result)) $boardcache[$row[boardparentid]][$row[sort]][$row[boardid]] = $row;
$result = $db_zugriff->query("SELECT boardid FROM bb".$n."_object2board WHERE objectid = '$user_group' AND boardpermission = 1");
while ($row = $db_zugriff->fetch_array($result)) $permissioncache[$row[boardid]] = 1;
$result = $db_zugriff->query("SELECT userid, username, boardid FROM bb".$n."_object2board LEFT JOIN bb".$n."_user_table ON (bb".$n."_object2board.objectid = bb".$n."_user_table.userid) WHERE mod = 1 ORDER BY username ASC");
while ($row = $db_zugriff->fetch_array($result)) $modcache[$row[boardid]][] = $row;
$result = $db_zugriff->query("SELECT announcementid, topic, bb".$n."_announcements.userid, username FROM bb".$n."_announcements LEFT JOIN bb".$n."_user_table ON (bb".$n."_user_table.userid=bb".$n."_announcements.userid) WHERE starttime <= '$time' AND endtime >= '$time' AND (boardid=0 OR boardid='$boardid') ORDER BY starttime DESC");
$anzahl = $db_zugriff->query_first("SELECT COUNT(threadid)as anzahl FROM bb".$n."_threads WHERE (boardparentid='$boardid' OR putoffid='$boardid') AND (timelastreply>='$date' OR important='1')");
$anzahl = $anzahl[anzahl];
if(!$page) $page=1;
$getthreadids=$db_zugriff->query("SELECT threadid FROM bb".$n."_threads WHERE (boardparentid='$boardid' OR putoffid='$boardid') AND (timelastreply>='$date' OR important='1') ORDER by important DESC, $sortfield $sortorder LIMIT ".($tproseite*($page-1)).",".($tproseite));